<style scoped lang="scss">
.contnet {
    width: 90%;
    height: calc(100vh - 50px);
    // background: #ccc;
    margin: auto;

    dl {
        display: flex;
        border: 1px solid #ccc;
        margin-top: 20px;

        dt {
            img {
                padding: 10px;
            }
        }

        dd {
            padding-left: 10px;
            line-height: 30px;
        }
    }
}
</style>
<template>
    <div>
        <!-- 使用组件 -->
        <homeTop :showicon2="false" :showspan3="true" ></homeTop>
        <div class="contnet">
            <dl v-for="(item, index) in historyData" :key="index">
                <dt>
                    <!-- <img style="width: 100px;height: 100px;border-radius: 50%;" :src="item.doctorHeadPic" alt=""@click="onimg(item.userId)"> -->
                     <Image style="width: 100px;height: 100px;border-radius: 50%;" :dataSrc="item.doctorHeadPic" alt=""@click="onimg(item.userId)" ></Image>
                </dt>
                <dd>
                    <h4>问诊人&emsp;{{ item.nickName }}</h4>
                    <p>问诊时间</p>
                    <p>
                        <el-button type='primary' @click="oncon(item.recordId)">查看问诊记录</el-button>
                        <el-button type='primary'>查看评价</el-button>
                    </p>
                </dd>
            </dl>
        </div>
    </div>
</template>
<script setup lang="ts">
// 引入头部组件
import homeTop from '@/components/homeTop/index.vue'
// 引入接口
import { getHistory } from '@/api/homeapi/index'
import { reactive, ref } from 'vue';
import { useRouter } from 'vue-router';
import Image from '@/components/image/index.vue'
// 获取医生id和sessionId
const doctorId = JSON.parse(localStorage.getItem('doctorId') as string)
const sessionId = JSON.parse(localStorage.getItem('sessionId') as string)
// 定义接口page	
const page = ref(1)
// 定义接口count
const count = ref(5)
// 定义对象
const config = reactive({
    page: page.value,
    count: count.value,
})
const historyData = ref()
getHistory(doctorId, sessionId, config).then(res => {
    historyData.value = res.data.result
    console.log(historyData.value);

})
const router = useRouter()
const oncon = (recordId: any) => {
    console.log(recordId);
    router.push({
        path: "/consultationchatrecords",
        query: {
            recordId: recordId
        }
    })
}
const onimg = (userId: any) => {
    console.log(userId);
    router.push({
        path: '/patientInformation',
        query: {
            userId: userId
        }
    })
}
</script>